home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / music / dsik_pas.zip / EXAM1.PAS < prev    next >
Pascal/Delphi Source File  |  1994-07-28  |  2KB  |  76 lines

  1. (*  exam1.pas - Digital Sound Interface Kit V1.01a example code
  2.  
  3.     Copyright 1993,94 Carlos Hasan
  4. *)
  5.  
  6. {$define UseTS}
  7.  
  8. program Example;
  9. uses Crt,Sound,Load,TS;
  10.  
  11. var
  12.   Card   : DSMCard;
  13.   Module : PDSM;
  14.   Volume : Integer;
  15. begin
  16.   if DSMLoadSetup(Card) then begin
  17.     writeln('Please run SETUP.EXE to configure.');
  18.     exit;
  19.   end;
  20.   if DSMInit(Card) then begin
  21.     writeln('Error Initializing the Sound System.');
  22.     exit;
  23.   end;
  24.   Module := DSMLoad('64MANIA.DSM',0);
  25.   if Module = nil then begin
  26.     case DSMStatus of
  27.       ERR_NORAM:  writeln('Not enough system memory.');
  28.       ERR_NODRAM: writeln('Not enough card memory.');
  29.       ERR_NOFILE: writeln('File not found.');
  30.       ERR_FORMAT: writeln('Invalid file format.');
  31.       ERR_ACCESS: writeln('File damaged.');
  32.     end;
  33.     DSMDone;
  34.     exit;
  35.   end;
  36.   writeln('Playing music.');
  37.   DSMSetupVoices(Module^.Song.NumChannels,Module^.Song.MasterVolume);
  38.   DSMPlayMusic(Module);
  39.  
  40. {$ifdef UseTS}
  41.   TSInit;
  42.   TSSetRate(70);
  43.   TSSetRoutine(DSMPoll);
  44. {$endif}
  45.  
  46.   for Volume := 0 to 255 do begin
  47. {$ifndef UseTS}
  48.     DSMPoll;
  49. {$endif}
  50.     DSMSetMusicVolume(Volume);
  51.     Delay(20);
  52.   end;
  53.  
  54.   while not keypressed do begin
  55. {$ifndef UseTS}
  56.     DSMPoll;
  57. {$endif}
  58.   end;
  59.  
  60.   for Volume := 255 downto 0 do begin
  61. {$ifndef UseTS}
  62.     DSMPoll;
  63. {$endif}
  64.     DSMSetMusicVolume(Volume);
  65.     Delay(20);
  66.   end;
  67.  
  68.   DSMStopMusic;
  69.   DSMFree(Module);
  70. {$ifdef UseTS}
  71.   TSDone;
  72.   TSRestoreTime;
  73. {$endif}
  74.   DSMDone;
  75. end.
  76.